home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / OS / FWFiles / SLFilPar.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  5.2 KB  |  132 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                SLFilPar.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef SLFILPAR_H
  11. #define SLFILPAR_H
  12.  
  13. #ifndef SLSTRREP_H
  14. #include "SLStrRep.h"
  15. #endif
  16.  
  17. #ifndef FWFILESY_H
  18. #include "FWFileSy.h"
  19. #endif
  20.  
  21. #if defined(FW_BUILD_MAC) && !defined(__TYPES__)
  22. #include <Types.h>
  23. #endif
  24.  
  25. //========================================================================================
  26. // Forward class declarations
  27. //========================================================================================
  28. class FW_ODirectorySpecification;
  29.  
  30.  
  31. //========================================================================================
  32. // Parsing Constants
  33. //========================================================================================
  34. const FW_Char FW_kExtensionDelimiter = (FW_Char)('.');
  35.     
  36. #ifdef FW_BUILD_WIN
  37. const FW_Char FW_kPathDelimiter = (FW_Char)('\\');
  38. const FW_Char FW_kDriveDelimiter = (FW_Char)(':');
  39. #endif
  40.  
  41. #ifdef FW_BUILD_MAC
  42. const FW_Char FW_kPathDelimiter = (FW_Char)(':');
  43. const FW_Char FW_kDriveDelimiter = (FW_Char)(':');
  44. #endif
  45.  
  46.  
  47. //========================================================================================
  48. //    This is a helper for FW_PFileSpecification and FW_ODirectorySpecification.
  49. //  It provides functions to parse file names and extract different parts.
  50. //    The methods *can throw*, so do not export them.
  51. //========================================================================================
  52.  
  53. FW_EXTERN_C_BEGIN
  54.  
  55. extern FW_Boolean FW_PrivFileSystemParser_IsPartialPath(FW_HString pathName);
  56.     // Returns TRUE if pathName specifies a partial pathName.  This routine is
  57.     //   an implementation routine, but may be used by subclasses.
  58.  
  59. extern void FW_PrivFileSystemParser_AddDelimiter(FW_HString* pathName);
  60.     // Adds a trailing delimiter character to the pathName if one belongs
  61.     //   there.  
  62.  
  63. extern FW_Boolean FW_PrivFileSystemParser_HasExtension(FW_HString fileName,
  64.                                                        FW_CharacterPosition& dotPosition);
  65.     // Returns TRUE if the fileName has a dot-extension.  Returns the position of
  66.     //   the dot as an index into fileName.
  67.  
  68. extern void FW_PrivFileSystemParser_ChangeExtension(FW_HString pathName,
  69.                                                     FW_HString extension,
  70.                                                     FW_HString* returnName);
  71.     // Changes the Windows file extension for the file specified by pathName.  
  72.     //   The new pathName is returned in returnName.  If no extension existed, then
  73.     //   the new extension is just added.
  74.  
  75. extern FW_Boolean FW_PrivFileSystemParser_GetExtension(FW_HString pathName,
  76.                                                        FW_HString* extension);
  77.     // Gets the Windows file extension of the file specified by pathName and returns
  78.     //   it in extension.  Returns TRUE if there was an extension to return.
  79.  
  80. extern FW_Boolean FW_PrivFileSystemParser_GetFileName(FW_HString pathName,
  81.                                                       FW_HString* fileName);
  82.     // Determines the file name and extension of pathName and returns it in fileName.
  83.     //   Returns TRUE if there was a filename to return, or FALSE if there was none.
  84.     //   Note that this doesn't throw exceptions because it can be used for directories
  85.     //   as well as files.
  86.  
  87. extern FW_Boolean FW_PrivFileSystemParser_GetJustFileName(FW_HString pathName,
  88.                                                           FW_HString* fileName);
  89.     // Returns the file name without extension of pathName.  Returns TRUE if there
  90.     //   was a file name portion to return.
  91.  
  92. extern FW_PlatformError FW_PrivFileSystemParser_PrivGetWorkingDirectory(FW_HString* pathName);
  93.     // Return the current working directory as a text string.
  94.  
  95.  
  96. #ifdef FW_BUILD_WIN
  97. extern FW_Boolean FW_PrivFileSystemParser_WinGetPathName(FW_HString fullPathName,
  98.                                                           FW_HString* pathName);
  99.     // Returns the path portion of fullPathName.  This works for both files and
  100.     //   directories.  Returns TRUE if there was a path portion to return.
  101.  
  102. extern FW_Boolean FW_PrivFileSystemParser_WinGetDrivePath(FW_HString pathName,
  103.                                                            FW_HString* drivePath);
  104.     // Returns the drive letter and colon character portion of pathName.  Returns
  105.     //   TRUE if there was a drive letter to return.
  106.  
  107. extern void FW_PrivFileSystemParser_WinExpandPartialPath(FW_HString* pathName);
  108.     // Takes a partial pathName and expands it to a fully qualified path.
  109.     //   pathName contains the partial path on entry and the full path on exit.
  110.     //   Since the old contents of pathName get overwritten, the user may want
  111.     //   to store a copy of them somewhere.
  112. #endif
  113.  
  114.  
  115. #ifdef FW_BUILD_MAC
  116. extern OSErr FW_PrivFileSystemParser_MacGenerateFullPathName(short vRefNum,
  117.                                                               long dirID,
  118.                                                               FW_HString* pathName);
  119.     // Generates a full Macintosh pathname based on vRefNum and dirID.  Returns
  120.     //   TRUE if the path was successfully generated, otherwise returns FALSE.
  121.  
  122. extern OSErr FW_PrivFileSystemParser_MacGenerateDirectory(short vRefNum,
  123.                                                            long dirID,
  124.                                                            FW_ODirectorySpecification* directory);
  125.     // Generates a directory spec based on vRefNum and dirID.  This routine can
  126.     //   be used recursively to generate a full directory pathname.
  127. #endif
  128.  
  129. FW_EXTERN_C_END
  130.  
  131. #endif
  132.